﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Assist;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using YArchitech.Controls;
using YArchitech.LIB;
using YArchitech.Revit.MEP.Opening.Common;
using YArchitech.Revit.RevitExtension;
using HYDrawTool;
using HYView;
using TableTools;
using TableTools.Designer;

namespace YArchitech.Revit.MEP.Opening
{
	[Transaction(TransactionMode.Manual)]
	[Regeneration(RegenerationOption.Manual)]
	public class CmdOpeningDim : IExternalCommand
	{
		public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elems)
		{
			try
			{
				string viewName = cmdData.Application.ActiveUIDocument.ActiveView.ViewName;
				string text = "(洞图)";
				if (viewName.IndexOf(text) < 0)
				{
					CmdViewType types = (CmdViewType)3;
					if (SwitchView.SetUsableViewIncludeKeyWord(types, cmdData, text) != null)
					{
						YJKMessageBox.Show("请先开洞，创建洞口视图!");
						return Autodesk.Revit.UI.Result.Failed;
					}
				}
				UIDocument activeUIDocument = cmdData.Application.ActiveUIDocument;
                this.m_LineStyle = LineTypeTool.CreateLineType(activeUIDocument.Document, "红色交叉线", new Autodesk.Revit.DB.Color(byte.MaxValue, 0, 0), 1, (GraphicsStyleType)1);
				this.GetAllOpeningDim(activeUIDocument.Document);
                Result result = Result.Cancelled;
				List<FilledRegion> list = new List<FilledRegion>();
				while (this.SelectOpeningFillRegion(activeUIDocument, list))
				{
					if (list.Count >= 1)
					{
						if (this.m_dimConfig.DimHoleStyle == ConfigDataOperate.EDimHoleStyle.eDimStyleByLabel)
						{
							if (list.Count == 1)
							{
								result = this.DimSingleOpeningLabel(activeUIDocument, list[0]);
							}
							else if (list.Count > 1)
							{
								result = this.DimMutilOpeningLabel(activeUIDocument, list);
							}
						}
						else
						{
							result = this.DimOpeningTable(cmdData, list);
						}
						if (result == Autodesk.Revit.UI.Result.Cancelled)
						{
							break;
						}
					}
				}
				LineTypeTool.DeleteLineType(activeUIDocument.Document, "红色交叉线");
			}
			catch
			{
				LineTypeTool.DeleteLineType(cmdData.Application.ActiveUIDocument.Document, "红色交叉线");
				return Autodesk.Revit.UI.Result.Failed;
			}
			return Autodesk.Revit.UI.Result.Succeeded;
		}

		public CmdOpeningDim()
		{
			this.m_LineStyle = null;
			string strXmlFilePath = ConfigDataOperate.InitOpenHoleDataConfigFile();
			this.m_dimConfig = new ConfigDataOperate.OpenHoleConfigData(strXmlFilePath);
		}

		public Result DimMutilOpeningLabel(UIDocument UIDoc, List<Element> lstOpening)
		{
			XYZ xyz = new XYZ(4.0, 4.0, 0.0);
			string labelDimFamilyName = this.GetLabelDimFamilyName(XYZ.Zero, XYZ.Zero + xyz);
			FamilySymbol familySymbol = this.LoadOpeningDimFamily(UIDoc.Document, labelDimFamilyName);
			if (familySymbol == null)
			{
				return Autodesk.Revit.UI.Result.Cancelled;
			}
			foreach (Element opening in lstOpening)
			{
				if (this.DimOneOpeningLabel(UIDoc, opening, familySymbol) != null)
				{
					return Autodesk.Revit.UI.Result.Cancelled;
				}
			}
			return Autodesk.Revit.UI.Result.Succeeded;
		}

		public Result DimOpeningTable(ExternalCommandData cmdData, List<Element> lstOpening)
		{
			int rowCount = 0;
			int colCount = 0;
			List<CellInfo> openingDimCellInfo = this.GetOpeningDimCellInfo(lstOpening, ref rowCount, ref colCount);
			if (openingDimCellInfo.Count < 5)
			{
				YJKMessageBox.Show("提取不到墙洞标注信息。");
				return Autodesk.Revit.UI.Result.Cancelled;
			}
			Document document = cmdData.Application.ActiveUIDocument.Document;
			Autodesk.Revit.DB.View activeView = cmdData.Application.ActiveUIDocument.ActiveView;
			TextNoteType textNoteType = YJKElementFilter.GetElementByClass(typeof(TextNoteType), document).Cast<TextNoteType>().FirstOrDefault<TextNoteType>();
			string text = "";
			if (TableInterface.DrawGeneralTable(cmdData, rowCount, colCount, openingDimCellInfo, activeView, textNoteType, ref text, null, null, true) != null)
			{
				return Autodesk.Revit.UI.Result.Cancelled;
			}
			FamilySymbol familySymbol = this.LoadOpeningDimFamily(document, "洞口标注-编号");
			if (familySymbol == null)
			{
				return Autodesk.Revit.UI.Result.Cancelled;
			}
			Transaction transaction = new Transaction(document);
			transaction.Start("UpdateOpeningNumber");
			try
			{
				int num = 1;
				foreach (Element elem in lstOpening)
				{
					string text2 = string.Format("{0}{1}", this.m_dimConfig.DimPrefixItem, num);
					elem.GetParameter("标记").Set(text2);
					num++;
				}
			}
			catch
			{
				YJKMessageBox.Show("更新洞口标记失败！");
				transaction.RollBack();
				return Autodesk.Revit.UI.Result.Cancelled;
			}
			transaction.Commit();
			double dTextH = textNoteType.GetParameter(BuiltInParameter.TEXT_SIZE).AsDouble() * (double)activeView.Scale;
			foreach (Element element in lstOpening)
			{
				this.ClearOpeningDim(document, element.Id);
				this.CreateOpeningNumberDim(document, familySymbol, element, dTextH);
			}
			return Autodesk.Revit.UI.Result.Succeeded;
		}

		private bool SelectOpeningFillRegion(UIDocument UIDoc, List<FilledRegion> lstSelRegion)
		{
			double archOpeningDimMinSize = new ConfigDataOperate.OpenHoleConfigData(ConfigDataOperate.InitOpenHoleDataConfigFile()).ArchOpeningDimMinSize;
			try
			{
				OpeningFillRegionFilter openingFillRegionFilter = new OpeningFillRegionFilter(archOpeningDimMinSize);
				IEnumerable<Element> enumerable = UIDoc.Selection.PickElementsByRectangle(openingFillRegionFilter, "请框选墙洞、楼板洞");
				lstSelRegion.Clear();
				foreach (Element element in enumerable)
				{
					lstSelRegion.Add(element as FilledRegion);
				}
				return true;
			}
			catch
			{
			}
			return false;
		}

		public static bool IsOpening2DRegionSizeStatify(Element OpeningFillRegion, double dMaxSize)
		{
			Element element = CmdOpeningDim.FindLinkOpening3dElement(OpeningFillRegion.Document, OpeningFillRegion as FilledRegion);
			if (element == null)
			{
				return false;
			}
			FamilyInstance familyInstance = element as FamilyInstance;
			Wall wall = familyInstance.Host as Wall;
			if (wall == null)
			{
				return true;
			}
			if (CmdTools.IsPrimaryStructure(wall.Id, OpeningFillRegion.Document))
			{
				return true;
			}
			string name = familyInstance.Symbol.Family.Name;
			double num;
			if (name.IndexOf("矩形墙洞_") == 0)
			{
				double val = familyInstance.GetParameter("洞口高度").AsDouble();
				double val2 = familyInstance.GetParameter("洞口宽度").AsDouble();
				num = Math.Max(val, val2);
			}
			else
			{
				if (name.IndexOf("圆形墙洞_") != 0)
				{
					return true;
				}
				num = familyInstance.GetParameter("洞口半径").AsDouble() * 2.0;
			}
			num = AssistFunc.feetToMM(num);
			return num >= dMaxSize;
		}

		private static Element FindLinkOpening3dElement(UIDocument UIDoc, FilledRegion OpeningFillRegion)
		{
			return CmdOpeningDim.FindLinkOpening3dElement(UIDoc.Document, OpeningFillRegion);
		}

		private static Element FindLinkOpening3dElement(Autodesk.Revit.DB.Document Doc, FilledRegion OpeningFillRegion)
		{
			int num = CmdTools.ReadFromElement(OpeningFillRegion, DbOpeningBase.guidOpening3D);
			if (num == 0)
			{
				return null;
			}
			Element elementById = Doc.GetElementById(new ElementId(num));
			if (elementById == null)
			{
				return null;
			}
			return elementById;
		}

		private Result DimSingleOpeningLabel(UIDocument UIDoc, FilledRegion OpeningFillRegion)
		{
			Element element = CmdOpeningDim.FindLinkOpening3dElement(UIDoc, OpeningFillRegion);
			if (element == null)
			{
				YJKMessageBox.Show("查找关联的洞口失败!");
				return Autodesk.Revit.UI.Result.Cancelled;
			}
			return this.DimOneOpeningLabel(UIDoc, element, null);
		}

		private Result DimMutilOpeningLabel(UIDocument UIDoc, List<FilledRegion> lstOpeningFillRegion)
		{
			List<Element> list = new List<Element>();
			foreach (FilledRegion openingFillRegion in lstOpeningFillRegion)
			{
				Element element = CmdOpeningDim.FindLinkOpening3dElement(UIDoc, openingFillRegion);
				if (element == null)
				{
					YJKMessageBox.Show("查找关联的洞口失败！");
					return Autodesk.Revit.UI.Result.Cancelled;
				}
				list.Add(element);
			}
			return this.DimMutilOpeningLabel(UIDoc, list);
		}

		private Result DimOneOpeningLabel(UIDocument UIDoc, Element opening, FamilySymbol dimSymbol)
		{
			if (!this.UpdateOpeningElev(UIDoc.Document, opening))
			{
				YJKMessageBox.Show("更新洞口标注信息失败！");
				return Autodesk.Revit.UI.Result.Cancelled;
			}
			XYZ ptDim = null;
			XYZ point = (opening.Location as LocationPoint).Point;
			if (dimSymbol == null)
			{
				if (this.GetOpeningLabelDimParam(UIDoc, point, ref ptDim, ref dimSymbol) != null)
				{
					return Autodesk.Revit.UI.Result.Cancelled;
				}
			}
			else
			{
				XYZ xyz = new XYZ(4.0, 4.0, 0.0);
				ptDim = point + xyz;
			}
			this.ClearOpeningDim(UIDoc.Document, opening.Id);
			this.CreateOpeningLabelDim(UIDoc.Document, dimSymbol, opening, point, ptDim);
			return Autodesk.Revit.UI.Result.Succeeded;
		}

		private Result DimOpeningTable(ExternalCommandData cmdData, List<FilledRegion> lstOpeningFillRegion)
		{
			Document document = cmdData.Application.ActiveUIDocument.Document;
			List<Element> openingByFillRegion = this.GetOpeningByFillRegion(document, lstOpeningFillRegion);
			if (openingByFillRegion.Count < 1)
			{
				YJKMessageBox.Show("找不到关联的墙洞。");
				return Autodesk.Revit.UI.Result.Cancelled;
			}
			return this.DimOpeningTable(cmdData, openingByFillRegion);
		}

		private List<Element> GetOpeningByFillRegion(Autodesk.Revit.DB.Document doc, List<FilledRegion> lstFillRegion)
		{
			List<Element> list = new List<Element>();
			foreach (FilledRegion elem in lstFillRegion)
			{
				int num = CmdTools.ReadFromElement(elem, DbOpeningBase.guidOpening3D);
				if (num != 0)
				{
					ElementId elementId = new ElementId(num);
					Element elementById = doc.GetElementById(elementId);
					if (elementById != null && this.UpdateOpeningElev(doc, elementById))
					{
						list.Add(elementById);
					}
				}
			}
			return (from e in list
			orderby e.GetParameter(DbOpeningBase.m_strSharedParaOpeningMajor).AsString()
			select e).ToList<Element>();
		}

		private List<CellInfo> GetOpeningDimCellInfo(List<Element> lstOpening, ref int rowCount, ref int colCount)
		{
			rowCount = lstOpening.Count + 1;
			colCount = 4;
			List<CellInfo> list = new List<CellInfo>();
			list.Add(new CellInfo(0, 0, 0, 0, "编号", CellInfo.CellInfoType.CIT_Text));
			list.Add(new CellInfo(0, 0, 1, 1, "尺寸", CellInfo.CellInfoType.CIT_Text));
			list.Add(new CellInfo(0, 0, 2, 2, "标高", CellInfo.CellInfoType.CIT_Text));
			list.Add(new CellInfo(0, 0, 3, 3, "专业", CellInfo.CellInfoType.CIT_Text));
			string text = "";
			string text2 = "";
			string text3 = "";
			for (int i = 1; i <= lstOpening.Count; i++)
			{
				string text4 = string.Format("{0}{1}", this.m_dimConfig.DimPrefixItem, i);
				text2 = (text = (text3 = ""));
				this.GetOpeningDimParam(lstOpening[i - 1], ref text, ref text2, ref text3);
				if (!string.IsNullOrEmpty(text) || !string.IsNullOrEmpty(text2) || !string.IsNullOrEmpty(text3))
				{
					list.Add(new CellInfo(i, i, 0, 0, text4, CellInfo.CellInfoType.CIT_Text));
					list.Add(new CellInfo(i, i, 1, 1, text2, CellInfo.CellInfoType.CIT_Text));
					list.Add(new CellInfo(i, i, 2, 2, text3, CellInfo.CellInfoType.CIT_Text));
					list.Add(new CellInfo(i, i, 3, 3, text, CellInfo.CellInfoType.CIT_Text));
				}
			}
			return list;
		}

		private bool GetOpeningDimParam(Element opening, ref string strCategory, ref string strSize, ref string strElev)
		{
			bool flag = false;
			try
			{
				flag = (opening as FamilyInstance).Symbol.Name.Contains("矩形");
			}
			catch
			{
			}
			ConfigDataOperate.EOpeningLevelBase eopeningLevelBase = flag ? this.m_dimConfig.RectOpeningLevelBase : this.m_dimConfig.CircleOpeningLevelBase;
			Parameter parameter = opening.GetParameter(DbOpeningBase.m_strSharedParaOpeningMajor);
			if (parameter == null)
			{
				return false;
			}
			Parameter parameter2 = opening.GetParameter(DbOpeningBase.m_strSharedParaOpeningSize);
			if (parameter2 == null)
			{
				return false;
			}
			Parameter parameter3;
			if (eopeningLevelBase == ConfigDataOperate.EOpeningLevelBase.eLevelBaseTop)
			{
				parameter3 = opening.GetParameter(DbOpeningBase.m_strSharedParaOpeningElevTop);
			}
			else if (eopeningLevelBase == ConfigDataOperate.EOpeningLevelBase.eLevelBaseCenter)
			{
				parameter3 = opening.GetParameter(DbOpeningBase.m_strSharedParaOpeningElevCenter);
			}
			else
			{
				parameter3 = opening.GetParameter(DbOpeningBase.m_strSharedParaOpeningElevBottom);
			}
			if (parameter3 == null)
			{
				return false;
			}
			if (parameter.HasValue)
			{
				strCategory = parameter.AsString();
			}
			if (parameter2.HasValue)
			{
				strSize = parameter2.AsString();
			}
			if (parameter3.HasValue)
			{
				strElev = parameter3.AsString();
			}
			return true;
		}

		private Result GetOpeningLabelDimParam(UIDocument UIDoc, XYZ ptOpeningPos, ref XYZ ptDim, ref FamilySymbol dimSymbol)
		{
			ptDim = this.PickPointByBase(UIDoc, "请确定标注位置", ptOpeningPos);
			if (ptDim == null)
			{
				return Autodesk.Revit.UI.Result.Cancelled;
			}
			string labelDimFamilyName = this.GetLabelDimFamilyName(ptOpeningPos, ptDim);
			dimSymbol = this.LoadOpeningDimFamily(UIDoc.Document, labelDimFamilyName);
			if (dimSymbol == null)
			{
				return Autodesk.Revit.UI.Result.Failed;
			}
			return Autodesk.Revit.UI.Result.Succeeded;
		}

		private string GetLabelDimFamilyName(XYZ ptPos, XYZ ptDim)
		{
			string result;
			if (ptDim.X > ptPos.X)
			{
				if (this.m_dimConfig.DimMajor)
				{
					result = "洞口标注-右-带圆圈";
				}
				else
				{
					result = "洞口标注-右-不带圆圈";
				}
			}
			else if (this.m_dimConfig.DimMajor)
			{
				result = "洞口标注-左-带圆圈";
			}
			else
			{
				result = "洞口标注-左-不带圆圈";
			}
			return result;
		}

		private FamilySymbol LoadOpeningDimFamily(Autodesk.Revit.DB.Document doc, string familyName)
		{
			FamilySymbol familySymbol = YJKRevitTools.GetFamilySymbol(familyName, doc);
			if (familySymbol != null)
			{
				return familySymbol;
			}
			Transaction transaction = new Transaction(doc);
			transaction.Start("LoadFamily");
			try
			{
				string text = Path.Combine(Product.FamilyLocation, RevitVersion.Version, "OpeningDim", familyName + ".rfa");
				doc.LoadFamily(text);
				familySymbol = YJKRevitTools.GetFamilySymbol(familyName, doc);
				transaction.Commit();
				return familySymbol;
			}
			catch
			{
				transaction.RollBack();
			}
			YJKMessageBox.Show("加载族 " + familyName + " 失败！");
			return null;
		}

		private bool UpdateOpeningElev(Autodesk.Revit.DB.Document doc, Element opening)
		{
			Transaction transaction = new Transaction(doc);
			transaction.Start("UpdateOpening");
			try
			{
				string text = "";
				string text2 = "";
				string text3 = "";
				this.GetOpeningDimParam(opening, ref text, ref text2, ref text3);
				opening.GetParameter("标注标高").Set(text3);
				transaction.Commit();
				return true;
			}
			catch
			{
				transaction.RollBack();
			}
			YJKMessageBox.Show("更新墙洞标注标高失败");
			return false;
		}

		private bool UpdateOpeningMark(Autodesk.Revit.DB.Document doc, Element opening, string strMark)
		{
			return true;
		}

		private void CreateOpeningLabelDim(Autodesk.Revit.DB.Document doc, FamilySymbol dimSymbol, Element opening, XYZ ptPos, XYZ ptDim)
		{
			Transaction transaction = new Transaction(doc);
			transaction.Start("CreateDimTag");
			UnifiedModified.ActivateFamilySymbol(dimSymbol);
			IndependentTag independentTag = doc.Create.NewTag(doc.ActiveView, opening, false, 0, 0, ptDim);
			if (independentTag != null)
			{
				independentTag.ChangeTypeId(new ElementId(dimSymbol.Id.IntegerValue));
				independentTag.HasLeader = true;
                independentTag.LeaderEndCondition = (LeaderEndCondition)1;
				independentTag.LeaderEnd = ptPos;
				this.m_lstOpeningDim.Add(independentTag);
			}
			transaction.Commit();
		}

		private void CreateOpeningNumberDim(Autodesk.Revit.DB.Document doc, FamilySymbol dimSymbol, Element opening, double dTextH)
		{
			if ((opening as FamilyInstance).Host == null)
			{
				return;
			}
			XYZ point = (opening.Location as LocationPoint).Point;
			TagOrientation tagOrientation = 0;
			this.GetOpeningNumberDimParam(doc, opening, dTextH, ref tagOrientation, ref point);
			Transaction transaction = new Transaction(doc);
			transaction.Start("CreateDimTag");
			UnifiedModified.ActivateFamilySymbol(dimSymbol);
			IndependentTag independentTag = doc.Create.NewTag(doc.ActiveView, opening, false, 0, tagOrientation, point);
			if (independentTag != null)
			{
				independentTag.ChangeTypeId(new ElementId(dimSymbol.Id.IntegerValue));
				this.m_lstOpeningDim.Add(independentTag);
			}
			transaction.Commit();
		}

		private void GetOpeningNumberDimParam(Autodesk.Revit.DB.Document doc, Element opening, double dTextH, ref TagOrientation orientation, ref XYZ ptDim)
		{
			Element host = (opening as FamilyInstance).Host;
			XYZ point = (opening.Location as LocationPoint).Point;
			if (host is Wall)
			{
				Wall wall = host as Wall;
				Curve curve = (wall.Location as LocationCurve).Curve;
				double num = dTextH + 0.5 * wall.WallType.Width;
				if (curve.GetType() == typeof(Line))
				{
					XYZ hyendPoint = curve.GetEndPoint(0);
					XYZ hyendPoint2 = curve.GetEndPoint(1);
					if (Math.Abs(hyendPoint.X - hyendPoint2.X) > Math.Abs(hyendPoint.Y - hyendPoint2.Y))
					{
						orientation = 0;
						ptDim = point + XYZ.BasisY * num;
						return;
					}
                    orientation = (TagOrientation)1;
					ptDim = point - XYZ.BasisX * num;
					return;
				}
			}
			else
			{
				BoundingBoxXYZ boundingBoxXYZ = (opening as FamilyInstance).get_BoundingBox(doc.ActiveView);
				double num2 = dTextH + 0.5 * (boundingBoxXYZ.Max.Y - boundingBoxXYZ.Min.Y);
				orientation = 0;
				ptDim = point + XYZ.BasisY * num2;
			}
		}

		private void GetAllOpeningDim(Autodesk.Revit.DB.Document doc)
		{
			this.m_lstOpeningDim = new List<IndependentTag>();
			foreach (Element element in YJKElementFilter.GetElementByClass(typeof(IndependentTag), doc))
			{
				IndependentTag independentTag = element as IndependentTag;
				if (independentTag != null && independentTag.TaggedLocalElementId != null)
				{
					this.m_lstOpeningDim.Add(independentTag);
				}
			}
		}

		private void ClearOpeningDim(Autodesk.Revit.DB.Document doc, ElementId openingId)
		{
			Transaction transaction = new Transaction(doc, "DeleteInstance");
			transaction.Start();
			for (int i = 0; i < this.m_lstOpeningDim.Count; i++)
			{
				IndependentTag independentTag = this.m_lstOpeningDim[i];
				if (independentTag.TaggedLocalElementId == openingId)
				{
					doc.Delete(independentTag.Id);
					this.m_lstOpeningDim.Remove(independentTag);
					i--;
				}
			}
			transaction.Commit();
		}

		private XYZ PickPointByBase(UIDocument UIDoc, string sCommandTip, XYZ ptBase)
		{
			List<ElementId> lstCurveId = new List<ElementId>();
			if (ptBase != null)
			{
				lstCurveId = this.DrawCrossFlag(UIDoc, ptBase);
			}
			try
			{
				XYZ xyz = UIDoc.Selection.PickPoint(sCommandTip);
				this.DeleteCrossFlag(UIDoc, lstCurveId);
				return new XYZ(xyz.X, xyz.Y, ptBase.Z);
			}
			catch
			{
				this.DeleteCrossFlag(UIDoc, lstCurveId);
			}
			return null;
		}

		private List<ElementId> DrawCrossFlag(UIDocument UIDoc, XYZ ptPos)
		{
			List<ElementId> list = new List<ElementId>();
			Transaction transaction = new Transaction(UIDoc.Document);
			transaction.Start("DrawCrossFlag");
			try
			{
				double num = AssistFunc.mmToFeet(200.0);
				CurveArray curveArray = new CurveArray();
				XYZ startPoint = new XYZ(ptPos.X - num, ptPos.Y + num, 0.0);
				XYZ endPoint = new XYZ(ptPos.X + num, ptPos.Y - num, 0.0);
				curveArray.Append(YJKLineEx.YJKGetBound(startPoint, endPoint));
				startPoint = new XYZ(ptPos.X + num, ptPos.Y + num, 0.0);
				endPoint = new XYZ(ptPos.X - num, ptPos.Y - num, 0.0);
				curveArray.Append(YJKLineEx.YJKGetBound(startPoint, endPoint));
				Autodesk.Revit.DB.View activeView = UIDoc.ActiveView;
				foreach (object obj in UIDoc.Document.Create.NewDetailCurveArray(activeView, curveArray))
				{
					DetailCurve detailCurve = (DetailCurve)obj;
					if (this.m_LineStyle != null)
					{
						detailCurve.LineStyle = this.m_LineStyle;
					}
					list.Add(detailCurve.Id);
				}
				transaction.Commit();
			}
			catch
			{
				transaction.RollBack();
			}
			return list;
		}

		private void DeleteCrossFlag(UIDocument UIDoc, List<ElementId> lstCurveId)
		{
			Transaction transaction = new Transaction(UIDoc.Document, "DeleteTempElements");
			transaction.Start();
			foreach (ElementId elementId in lstCurveId)
			{
				UIDoc.Document.Delete(elementId);
			}
			transaction.Commit();
		}

		private GraphicsStyle m_LineStyle;

		private List<IndependentTag> m_lstOpeningDim;

		private ConfigDataOperate.OpenHoleConfigData m_dimConfig;
	}
}
